﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Pages_StudentPages_StudentUpload : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["id"] == null)
        {
            Response.Redirect("StudentLogin.aspx");
        }
    }

    protected void btnMarkDesign_Click(object sender, EventArgs e)
    {
        int length = inputImg.PostedFile.ContentLength;
        byte[] imgbyte = new byte[length];
        HttpPostedFile img = inputImg.PostedFile;
        img.InputStream.Read(imgbyte, 0, length);
        Design d = new Design();
        d.Name = txtDesignName.Text;
        d.PostDate = DateTime.Now.Date.ToString();
        d.Quotation = txtQuotation.Text;
        d.Description = txtDescription.Text;
        d.Com.ComId = Convert.ToInt16(Request.QueryString["id"].ToString());
        d.St.Id =Convert.ToInt16(Session["id"]);
        StudentBUS st = new StudentBUS();
        if (st.insertDesign(d, imgbyte))
        {
            Response.Redirect("StudentsHome.aspx");
        }
        else
        {
            Response.Redirect("StudentUpload.aspx");
        }
    }
}